package cn.itcast.dtx.notifydemo.config;

import org.springframework.context.annotation.Configuration;

/**
 * Author：MoDebing
 * Version：1.0
 * Date：2022-10-19-19:05
 * Description:
 */
@Configuration
public class RedisConfig {

    //@Bean
    //public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
    //    RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
    //    redisTemplate.setConnectionFactory(redisConnectionFactory);
    //    // 使用GenericJackson2JsonRedisSerializer替换默认序列化
    //    GenericJackson2JsonRedisSerializer jackson2JsonRedisSerializer = new GenericJackson2JsonRedisSerializer();
    //    // 设置 Key 和 Value 的序列化规则
    //    redisTemplate.setKeySerializer(new StringRedisSerializer());
    //    redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);
    //    redisTemplate.setHashKeySerializer(new StringRedisSerializer());
    //    redisTemplate.setHashValueSerializer(jackson2JsonRedisSerializer);
    //    // 初始化 RedisTemplate 序列化完成
    //    redisTemplate.afterPropertiesSet();
    //    return redisTemplate;
    //}

}
